<?php
class Goldens_type_Model extends ORM {
	
	protected $table_name = 'goldens_type';
	protected $primary_key = 'goldens_type_id';
	protected $col_sort_order = 'goldens_type_sort_order';
	protected $col_goldens_type_status = 'goldens_type_status';
	protected $sorting = array('goldens_type_update_date' => 'desc');
	
	public function get()
	{
		$this->db->from($this->table_name);
		$this->db->select('*');
		$this->db->orderby($this->col_sort_order,'asc');
		$this->db->orderby($this->primary_key,'asc');
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
	
	public function get_with_active($language)
	{
		$this->db->select('*');
		$this->db->from($this->table_name);
		$this->db->join('goldens_type_content', 'goldens_type_content.goldens_type_id', 'goldens_type.goldens_type_id');
		$this->db->where('goldens_type_content.languages_id',$language);
		$this->db->where($this->col_goldens_type_status,'1');
		$this->db->orderby('goldens_type.'.$this->col_sort_order,'asc');
		$this->db->orderby('goldens_type.'.$this->primary_key,'desc');
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
}
?>